package itheima.com.exam.zy5;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;

public class Test {
    public static void main(String[] args) {
        TreeSet<Student> ts = new TreeSet<>(Comparator
                .comparingInt(Student::getTotal)   // 总分降序
                .thenComparingInt(Student::getPhysic).reversed());
        Student s1 = new Student("爱迪生", 90, 55);
        Student s2 = new Student("牛顿", 100, 90);
        Student s3 = new Student("拉瓦锡", 70, 100);
        Student s4 = new Student("霍金", 100, 100);
        Student s5 = new Student("伽利略", 60, 85);
        Student s6=new Student("达尔文", 70, 75);
        ts.add(s1);
        ts.add(s2);
        ts.add(s3);
        ts.add(s4);
        ts.add(s5);
        ts.add(s6);
        for (Student student : ts){
            System.out.println(student);
        }

    }
}
